const cloud = require('wx-server-sdk')
const {login}=require("./user")
exports.main = async ({action,data}, context) => {
  console.log("{action,data}  ",{action,data});
  if(action==="login"){
    return await login(data)
  }else{
    return {
      code:500,
      msg:"未知命令"
    }
  }
  
}
/**
 * 登录
 * 先判断账号是否注册
 * 未注册就注册
 * 注册了就直接登录
 * 
 * 注册信息
 * id
 * nickname
 * avatarUrl
 * mobile
 * role
 * 
 * 
  return {
    openid: wxContext.OPENID,
    appid: wxContext.APPID,
    unionid: wxContext.UNIONID,
    env: wxContext.ENV,
  }
 */
